package com.xiangban.xiangbanmall.utils;

import com.github.wxpay.sdk.WXPayConfig;
import lombok.Data;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
@Data
public class WXConfigUtil implements WXPayConfig {

    public  String APICLIENTCERT ;//证书

    public  String APP_ID;
    public String APP_KEY;
    public  String MCH_ID;

//    private final byte[] certData;
    public WXConfigUtil() throws Exception {
//        File file = new File("F:\\Download\\Java\\xiangban-common\\pay\\src\\main\\resources\\apiclient_cert.p12");
//        InputStream certStream = new FileInputStream(file);
//        this.certData = new byte[(int) file.length()];
//        certStream.read(this.certData);
//        certStream.close();
    }


    @Override
    public String getAppID() {
        return APP_ID;
    }

    @Override
    public String getMchID() {
        return MCH_ID;
    }

    @Override
    public String getKey() {
        return APP_KEY;
    }


    @Override
    public InputStream getCertStream() {
//        ByteArrayInputStream certBis = new ByteArrayInputStream(this.certData);
//        return certBis;
        return null;
    }

    @Override
    public int getHttpConnectTimeoutMs() {
        return 8000;
    }

    @Override
    public int getHttpReadTimeoutMs() {
        return 10000;
    }
}
